package com.boliq.lol.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.boliq.lol.base.BaseVpAdapter;
import com.boliq.lol.bean.NewsTypeBean;
import com.boliq.lol.ui.news.NewsArticleFragment;

/**
 * <pre>
 * ================================================
 * 作者: BLQ_SSNB
 * 日期：2021/2/20
 * 邮箱: blq_ssnb@outlook.com
 * 修改次数: 1
 * 描述:
 *      添加描述
 * ================================================
 * </pre>
 */
public class NewsVpAdapter extends BaseVpAdapter<NewsTypeBean> {

    public NewsVpAdapter(@NonNull FragmentManager fm) {
        super(fm);
    }

    @Override
    protected Fragment createFragment(int position) {
        Fragment fragment = null;
        NewsTypeBean bean = getData(position);
        if (bean.getType() == NewsTypeBean.TYPE_ARTICLE) {
            fragment = new NewsArticleFragment();
        }
        return fragment;
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return getData(position).getTitle();
    }
}
